
public class ArrayStack {
	private int[] theArray;
	private int topOfStack;
	private static int capacidade = 10;
	
	public ArrayStack(){
		theArray = new int[capacidade];
		topOfStack = -1;
	}
	
	public void push(int x){
		if(topOfStack + 1 == theArray.length)
			doubleArray();
		theArray[++topOfStack] = x;
	}
	
	public void pop( ) { 
		if(isEmpty()) 
			throw new UnderflowException("ArrayStack pop"); 
		 topOfStack--; 
	} 
}
